package org.hs.phd.odi.bgsub.features;

import java.awt.geom.Rectangle2D.Double;
import java.util.List;

import org.hs.phd.odi.bgsub.vob.VisualObject;
import org.hs.phd.odi.transformation.ODITransformation;
import org.hs.phd.odi.transformation.ODIUtils;

import com.googlecode.javacv.cpp.opencv_core.IplImage;

public class ODIShapeOverlappingFeatureDetector implements FeatureDetector {

	private final ODITransformation transformation;

	public ODIShapeOverlappingFeatureDetector(ODITransformation transformation) {
		this.transformation = transformation;
	}

	@Override
	public void detectAndSetFeatures(IplImage iplImage, List<VisualObject> objects) {
		for(VisualObject obj: objects){
			Double boundsOnTheSphere = ODIUtils.getBoundsOnTheSphere(transformation, obj.getPolygon());
			obj.setFeatures( new ShapeFeature( boundsOnTheSphere ));
		}
	}

	@Override
	public FeatureMatcher getFeatureMatcher() {
		return new ShapeOverlappingFeatureMatcher();
	}

}
